<include file="Public/header" title="历史报告" banner_selected="dropdown_item-active"/>
<div class="container container-user container-user-report">
        <div>
            <div class="section section-user">
                <div class="section_user">
                    <div class="user_body">
                        <div class="body_header">
                            <div class="header_title">
                                <span class="title_mine"><span class="mine_text">我发现</span><span class="mine_num"> {$post_num} </span><span class="mine_text">个漏洞</span></span>
                                <span class="title_rule">漏洞评审细则</span>
                            </div>
                            <div class="header_sift">
                                <div class="mod-form-search">
                                    <input id="post_title" class="form-search_input" type="text" placeholder="搜索名称">
                                    <input class="form-search_submit" type="submit" onclick="search_my_post();" value="">
                                </div>
								
								<div class="mod-form-sift mod-form-sift-tab" style="padding:0 0 0 0;">
								</div>
                                <!-- TO DO: 
								<div class="mod-form-sift mod-form-sift-tab">
                                    <div class="sift_tab sift_tab-active">
                                        <div class="">所有状态</div>
                                    </div>
                                    <div class="sift_tab">
                                        <div class="">处理中</div>
                                    </div>
                                    <div class="sift_tab">
                                        <div class="">已完成</div>
                                    </div>
                                    <div class="sift_tab">
                                        <div class="">已忽略</div>
                                    </div>
                                </div>
								-->
                            </div>
                        </div>

                        <div class="body_content">
                            <div class="mod-sheet-user-report">
                                <ul class="sheet_list" id="post_content">
									<foreach name="model" item="v">
										<li class="list_item">
											<a href="{:U('post/view?rid=')}{$v.id}">
												<div class="item_content">
													<h3>{$v.title}</h3>
													<span>{$v.time|date="Y/m/d",###}</span>
												</div>
												<if condition="$v.type eq 1"><p class="item_status colortips-black">审核中</p>
												<elseif condition="$v.type eq 2" /><p class="item_status colortips-gray">已忽略</p>
												<elseif condition="$v.type eq 3" /><p class="item_status colortips-orange">已确认</p>
												<elseif condition="$v.type eq 4" /><p class="item_status colortips-green">已修复</p>
												<elseif condition="$v.type eq 5" /><p class="item_status colortips-green">已完成</p>
												</if>
											</a>
										</li>
									</foreach>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
</div>
<script>
function search_my_post(){
							var  post_title_val = $("#post_title").val();
							$.ajax({
								url: "__ROOT__/user.php?m=user&c=post&a=search",
								type: "POST",
								data: {title:post_title_val},
								success: function (data) {
									if (data.status == "1") {
										$("#post_content").empty();
										$.each(data.result,function(i,item){
											var report_time = beautify_time(item['time']); 
											if(item['type']==1){
												var report_stage = '<p class="item_status colortips-black">审核中</p>';
											} else if (item['type']==2){
												var report_stage = '<p class="item_status colortips-gray">已忽略</p>';
											} else if (item['type']==3){
												var report_stage = '<p class="item_status colortips-orange">已确认</p>';
											} else if (item['type'==4]){
												var report_stage = '<p class="item_status colortips-green">已修复</p>';
											} else {
												var report_stage = '<p class="item_status colortips-black">审核中</p>';
											}
											$("#post_content").append("<li class=\"list_item\"><a href=\"/xsrc/user.php?m=user&amp;c=post&amp;a=view&amp;rid="+ item['id'] +"\"><div class=\"item_content\"><h3>"+ item['title'] +"</h3><span>"+ report_time +"</span></div>"+ report_stage +"</a></li>");
										});
									}else{
										$("#post_content").empty();
									}
								},
								error: function () {
									$("#post_content").empty();
								}
							});
}

function beautify_time(time){
    timestamp = parseInt(time + '000');
	var newDate = new Date(timestamp);
	var y = newDate.getFullYear();
	var m = newDate.getMonth() + 1;
	var d = newDate.getDate();
	var after_time = y + '/' + m + '/' + d;
	return after_time;
}

</script>
<include file="Public/footer" />